"""
@File    : father.py
@Author  : WorldWind(1772830365@qq.com)
@Time    : 2025/7/14
@Address : ChangSha - BoWeiFeng
@Date    : 2025/7/14 上午11:17
"""


class Father:
    nation = 'USA'
    skin = 'white'
    __password = '123'  # 私有属性不能被子类继承

    def __init__(self, name):
        self.name = name
        print(f"My name is {self.name}")

    def sing(self):
        print('I like singing!')

    @staticmethod
    def run():
        print('father ... run ...', Father.__name__)

    @classmethod
    def eat(cls):
        print('father ... eat ...', cls.__name__)

    def __ShowPassword(self):  # 私有方法不能被子类集成
        print(f'密码是: {self.__password}')


# 继承Father类
class Son(Father):
    nation = 'China'


class Grandson(Son):
    pass

    def sing(self):
        print("I don't like singing!")


s = Son('WorldWind')
print(s.nation)
print(s.skin)
print(s.name)
s.sing()
s.run()
s.eat()
print(s.nation)
s.sing()
# print(s.__password) 无法访问

print("--------------------------------")
f1 = Father('老约翰')
f1.eat()  # 父类
f1.run()
f1.sing()
print(f1.nation)
print("--------------------------------")

g1 = Grandson('雷霆嘎巴!')
print(g1.name)
g1.run()
g1.eat()
print(g1.nation)
g1.sing()
